﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Windows.Data;

namespace ChatGPT_SerialPortDemo.Bussinesses.Conventer
{
    public class ReverseBooleanConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            bool result = false;
            try
            {
                if(value != null && targetType == typeof(Boolean))
                {
                    result = !((bool)value);
                }
            }
            catch (Exception)
            {
            }
            return result;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            bool result = false;
            try
            {
                if (value != null && targetType == typeof(Boolean))
                {
                    result = !((bool)value);
                }
            }
            catch (Exception)
            {
                
            }
            return result;
        }
    }
}
